/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Ocso;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Alex
 */
public class InsertarProd {
public void Insertar(String cod,String prod,String precio){

        try {
           Connection c = DriverManager.getConnection("jdbc:mysql://localhost/Ventas", "root", "");
            PreparedStatement stm=c.prepareStatement("insert into productos values (?,?,?)");
           stm.setString(1, cod);
           stm.setString(2, prod);
          stm.setString(3, precio);


          stm.executeUpdate();
        } catch (SQLException ex) {
            Logger.getLogger(InsertarProd.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
